package com.hongsen.cn.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * create by erica
 * on 2019/9/26
 */
public class BootBroadcastReceiver extends BroadcastReceiver {
    static final String ACTION = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(ACTION)) {
            //            Intent mainActivityIntent = new Intent(context, MainActivity.class);  // 要启动的Activity
            Intent intents = context.getPackageManager().getLaunchIntentForPackage("com.hongsen.cn");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intents);
        }
    }
}